package com.example.gxwmvp;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.ListAdapter;
import android.widget.TextView;

import com.example.gxwmvp.bean.Girls;

import java.util.List;
import java.util.zip.Inflater;

class GirlsAdapter extends BaseAdapter {
    Context mContext;
    List<Girls> mGirlsList;


    public GirlsAdapter(Context context,List<Girls>girlsList)
    {
        this.mContext = context;
        mGirlsList = girlsList;

    }
    @Override
    public int getCount() {
        return mGirlsList.size();
    }

    @Override
    public Object getItem(int position) {
        return mGirlsList.get(position);
    }

    @Override
    public long getItemId(int position) {
        return 0;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {

        convertView = View.inflate(parent.getContext(), R.layout.list_item, null);
        ViewHolder holder = new ViewHolder();
        String girlName = mGirlsList.get(position).name;
        holder.tvName = convertView.findViewById(R.id.tvName);
        holder.tvName.setText(girlName);

        return convertView;
    }

    static class ViewHolder
    {
        ImageView imvGirl;
        TextView tvName;
    }
}
